/**
 * Project Name:AccessTokenController.java
 * File Name:AccessTokenController.java
 * Date:2018年06月05日 11:38
 * Copyright (c) 2018, zhang.xiangyu@foxmail.com All Rights Reserved.
 */
package com.meatball.api.login.controller;

import com.meatball.api.login.params.AccessTokenParams;
import com.meatball.api.login.service.AccessTokenService;
import com.meatball.component.OperateLog;
import com.meatball.vo.ResultMsg;
import io.swagger.annotations.*;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Title: LoginApiController
 * @Description: todo(登陆)
 * @Author 張翔宇
 * @Date 2018年06月05日 11:32
 * @Version V1.0
 */
@Api(tags = "权限认证")
@RestController
@RequestMapping("/api/token")
class AccessTokenController {
	@Resource
	private AccessTokenService service;
	
	/**
	 * @Title: validate
	 * @Description: todo(验证用户，并返回token)
	 * @Params: [user]
	 * @Return com.meatball.vo.ResultMsg    返回类型
	 * @Author 張翔宇
	 * @Date 2018年06月05日 14:18
	 */
	@ApiOperation(value = "获取access_token", notes = "获取权限认证令牌")
	@OperateLog("获取access_token")
	@PostMapping("/getaccesstoken")
	public ResultMsg getAccessToken(@RequestBody AccessTokenParams params) {
		return service.getAccessToken(params);
	}

	/**
	 * @Title: verifyAccessToken
	 * @Description: todo(验证权限)
	 * @Params: [token]
	 * @Return     返回类型
	 * @Author 張翔宇
	 * @Date 2018年06月11日 21:02
	 */
	@ApiOperation(value = "验证access_token", notes = "验证权限令牌")
	@OperateLog("验证access_token")
	@GetMapping("/{access_token}")
	public ResultMsg verifyAccessToken(@PathVariable String access_token) {
		return service.verifyAccessToken(access_token);
	}
}
  